package cn.hk.user.mapper;

import cn.hk.user.domain.UserRelation;
import cn.hk.user.domain.vo.FamilyDetailVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 家庭关系表 Mapper 接口
 * </p>
 *
 * @author xu
 * @since 2023-03-07
 */
@DataSource(DataSourceType.KELIN)
public interface UserRelationMapper extends BaseMapper<UserRelation> {
    void insertUserRelation( UserRelation userRelation);

    List<UserRelation> selectListByUserId(@Param("userIdLong") long userIdLong);

    Boolean deleteUserRelationByUserId(@Param("fromUserId")Long fromUserId,@Param("toUserId")Long toUserId);

    UserRelation selectOneByToUserId(@Param("id")Long id);

    List<Long> selectIdsByUserId(@Param("userId")long userId);

    List<FamilyDetailVo> selectFamilyDetailVosByFromUserId(@Param("userId")long userId);

    List<FamilyDetailVo> selectFamilyDetailVosByToUserId(@Param("userId")long userId);

    Boolean updateFamilyMemberRelation(@Param("fromUserId")Long fromUserId,@Param("toUserId") Long toUserId,@Param("relation") String relation);

    UserRelation selectOneByFromUserIdAndToUserId(@Param("fromUserId")Long fromUserId,@Param("toUserId") Long toUserId);

    List<Long> selectByFromUserId(@Param("fromUserId") Long fromUserId);
}
